import { $Http } from '@/config/service/http';

export enum Api {
  // 文件权限管理
  page = '/dmsfile/commonFilePermission/page', // 分页查询文件权限
  commonFilePermissionDelete = '/dmsfile/commonFilePermission/delete', // 删除
  batchDelete = '/dmsfile/commonFilePermission/batchDelete', // 批量删除
  changeStatus = '/dmsfile/commonFilePermission/changeStatus', // 状态更改
  commonFilePermissionGet = '/dmsfile/commonFilePermission/get', // 详情
  commonFilePermissionSave = '/dmsfile/commonFilePermission/save', // 保存
  fileTypeTree = '/dmsfile/commonFileDirectory/tree', // 查询文件类型树
  generateCode = '/system/sequence/rule/generateCode', // 生成编码[SYSTEM-CODE-RULE-001]
  roleList = '/system/role/list', // 角色列表[SYSTEM-ROLE-005]
  dataPermissionPage = '/dms/archivesDataPermission/page' // 数据权限管理列表
}

export const CODE_RULE = {
  WJJSBM: 'DMSFT01' // 文件权限管理-文件角色编码
};

export const roleList = (params) => {
  return $Http.api(Api.roleList, params, 'post');
};

export const page = (params) => {
  return $Http.api(Api.page, params, 'post');
};

export const commonFilePermissionDelete = (params) => {
  return $Http.api(Api.commonFilePermissionDelete, params, 'post');
};

export const batchDelete = (params) => {
  return $Http.api(Api.batchDelete, params, 'post');
};

export const changeStatus = (params) => {
  return $Http.api(Api.changeStatus, params, 'post');
};

export const commonFilePermissionSave = (params) => {
  return $Http.api(Api.commonFilePermissionSave, params, 'post');
};

export const commonFilePermissionGet = (id) => {
  return $Http.api(Api.commonFilePermissionGet, { id }, 'get', true);
};

export const generateCode = (params) => {
  return $Http.api(Api.generateCode, params, 'post');
};

export const fileTypeTree = (params) => {
  return $Http.api(Api.fileTypeTree, params, 'post');
};

export const dataPermissionPage = (params) => {
  return $Http.api(Api.dataPermissionPage, params, 'post');
};
